# nim c -r somesum.nim


import math

proc some_sum(n: int, m: int): int =
    var s: int = 0
    for k in countup(0,n):
        s += k^m
    return s

var n: int = 6000
var m: int = 3

let s_1 = n*(n+1)/2
let s_2 = n*(n+1)*(2*n+1)/6
let s_3 = (n*(n+1))^2/4

if m == 1:
    echo s_1
elif m == 2:
    echo s_2
elif m == 3:
    echo s_3
else:
    echo some_sum(n, m)

echo some_sum(60_000, 3) # 3240108000900000000
